package com.sbs.gaoxinqutoilet.adapter;


import android.view.View;

import androidx.annotation.LayoutRes;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sbs.gaoxinqutoilet.R;
import com.sbs.gaoxinqutoilet.entity.ShiGoInfoEntity;
import com.zhy.autolayout.utils.AutoUtils;

import java.util.List;

/**
 * Created by 聪明一只哈 on 2018/5/30.
 * Time: 2018/5/30  17:37AcceptItemEntity acceptItemEntity
 */

public class ToiletShiGoInfoRvAdapter extends BaseQuickAdapter<ShiGoInfoEntity.DataBean, ToiletShiGoInfoRvAdapter.BuyApplyViewHolder> {


    public ToiletShiGoInfoRvAdapter(@LayoutRes int layoutResId, @Nullable List<ShiGoInfoEntity.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BuyApplyViewHolder helper, ShiGoInfoEntity.DataBean item) {


        helper.setText(R.id.item_shigoinfo_tv_name,item.getHuming());
        helper.setText(R.id.item_shigoinfo_buildaccept,item.getGaizao_type_n());
        helper.setText(R.id.item_address_shigoinfo,item.getArea_name());
        helper.setText(R.id.item_shigoinfo_statedesc,item.getHasuptinfo_n());


        switch(item.getHasuptinfo_n()){
            case "未记录":
                helper.getView(R.id.item_shigoinfo_image).setBackgroundResource(R.drawable.unrebuild);
                break;
            case "已记录":
                helper.getView(R.id.item_shigoinfo_image).setBackgroundResource(R.drawable.alrebuild);
                break;

            default:
                helper.getView(R.id.item_shigoinfo_image).setBackgroundResource(R.color.bt_translates);

                break;
        }





//----------adapter条目点击-----------------------------------
//        helper.addOnClickListener(R.id.buy_apply_ll).addOnClickListener(R.id.buy_state_delete)
//                .addOnClickListener(R.id.buy_state_upload);

    }

    public class BuyApplyViewHolder extends BaseViewHolder {

        public BuyApplyViewHolder(View view) {
            super(view);
            AutoUtils.auto(view);
        }
    }
}
